﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="breadcrumb.ascx.cs"
    Inherits="VQWEB.administrator.controls.breadcrumb" %>
    <ol class="breadcrumb" id="breadcrumb_controls" style="margin-bottom: 10px">      
    </ol>
<script type="text/javascript">
    $(document).ready(function () {
        var url_xml = '<%=ResolveUrl("~/administrator/modules.xml") %>';
        var path = window.location.pathname;
        $.get(url_xml, function (xml) {
            $('module', xml).each(function (i) {
                var url_module = $(this).attr('url');
                var title_module = $(this).attr('title');
                if (path.indexOf(url_module) != -1) {
                    $("#breadcrumb_controls").append("<li><a href='" + url_module + "'>" + title_module + "</a></li>");
                }
            });
            $('action', xml).each(function (index) {
                var url_action = $(this).attr('url');
                var title_action = $(this).attr('title');
                url_action = url_action.replace("{Id}", "");
                if (path.indexOf(url_action) != -1) {
                    $("#breadcrumb_controls").append("<li><a href='" + url_action + "'>" + title_action + "</a></li>");
                }
            });

            //Disactive last li   
            var text = $(".breadcrumb li a").last().text();
            $(".breadcrumb li a").last().remove();
            var li = $(".breadcrumb li").last().attr("class", "active").text(text);
           

        });
    });
</script>
